package com.cszy.yydqbfq.common



import com.cszy.ewmxns.base.BaseEvent
import org.greenrobot.eventbus.EventBus


object EventUtils {

    /**
     * 注册
     *
     * @param subscriber
     */
    fun register(subscriber: Any?) {
        EventBus.getDefault().register(subscriber)
    }

    /**
     * 解除注册
     *
     * @param subscriber
     */
    fun unregister(subscriber: Any?) {
        EventBus.getDefault().unregister(subscriber)
    }

    /**
     * 发送事件
     *
     * @param event
     */
    fun sendEvent(event: BaseEvent?) {
        EventBus.getDefault().post(event)
    }

    /**
     * 发送粘性事件
     *
     * @param event
     */
    fun sendStickyEvent(event: BaseEvent?) {
        EventBus.getDefault().postSticky(event)
    }

    fun removeStickyEvent(event: BaseEvent?) {
        EventBus.getDefault().removeStickyEvent(event)
    }

}